Computer systems are based primarily on the interconnection of a plurality of digital devices, each designed to accomplish a specific function. A typical computer system comprises a central processing unit for processing data and control information, memory for temporarily storing information, input/output devices such as keyboards, monitors, floppy disk drives, hard disk drives and CD-ROM drives, and additional hardware to allow the above mentioned devices to communicate with each other.
A processing problem may occur in a computer system when one device depends on the operating speed of another device in the performance of its specified function. This problem is exemplified with reference to a computer system interacting with a CD-ROM drive. A CD-ROM drive contains its own processor responsible for controlling its operation, reading of requested data and communicating with other devices. In most CD-ROM drives, however, the processor is slow compared with the central processing unit of a computer system. As a result, when the central processing unit of a computer system sends a command to a CD-ROM drive, the central processing unit has to wait for the processor in the CD-ROM drive to process the command before the central processing unit can send another command. A typical CD-ROM drive requires a particular time period, such as 53 milliseconds, for example, to process a command sent from the computer system. Thus, the central processing unit, after sending a command to a CD-ROM drive, must wait until this particular time interval has elapsed before sending a second command to the CD-ROM drive. If the second command is sent from the central processing unit to the drive prior to the elapse of the time interval, it is possible that the processor in the CD-ROM drive will never execute the second command.
Computer designers have attempted to solve the above delay problem in computer systems by allowing the faster devices to perform other functions while they are waiting for the slower devices to perform their functions. For instance, a central processing unit might update a video display while waiting for a hard disk drive to retrieve requested information. In the context of a computer system interacting with a CD-ROM drive, an improvement in the overall throughput of the computer system is accomplished if the central processing unit is allowed to process other commands during the time interval in which the drive is processing its commands. Efficiency in overall throughput of the computer system is unnecessarily reduced, however, if the central processing unit waits longer than the particular time before sending the CD-ROM drive its next command, because the CD-ROM drive would then be idle while waiting for the next command.
It is therefore desirable that the central processing unit process other commands only during the particular time interval in which the CD-ROM is processing its command and no longer, sending the second command to the CD-ROM drive immediately when the drive is ready to receive it. What is needed is a method that allows the central processing unit to send a command to a CD-ROM drive, process other information for exactly the time period the drive requires to process its command (e.g., 53 ms), and then send the CD-ROM drive another command.
Several methods have been utilized in computer systems to allow the central processing unit to measure the duration of particular processes. One method that is well known in the art is the use of a hardware interrupt timer. A hardware interrupt timer is a device attached to a system reference (a quartz crystal) in a computer system which counts the cycles generated by the system reference. When the interrupt timer counts a particular number of clock cycles, it generates an interrupt to a timer counter. The timer counter increments itself upon receipt of any interrupt from the interrupt timer. The timer counter can then be read by a central processing unit.
A problem with utilizing a hardware interrupt timer to measure the duration of particular processing intervals in a computer system is that such a timer is often unavailable or is not readily accessible to a programmer who desires to time particular events. For example, the timer may be unavailable because it is dedicated to the task of maintaining a system clock. A hardware interrupt timer is programmed to generate an interrupt to a timer counter every 1/18th of a second, for example, so that the timer counter can maintain a current date and time. This system date and time is used by the operating system of the personal computer and by application programs to perform particular tasks at specified times, and to reference particular files with the time and date they were created, stored or last changed. The hardware interrupt timer is thus generally unavailable to be used for timing particular processes.
It is known to reprogram a personal computer's hardware interrupt timer for purposes of timing particular processes. The central processing unit reads the value in the timer counter and stores the value in a temporary register. The central processing unit then reprograms the hardware interrupt timer to correspond to a particular time interval of interest, and clears the timer counter to equal zero. The hardware interrupt timer interrupts the timer counter, in the manner discussed above, corresponding to the reprogrammed time interval. The central processing unit reads the timer counter for purposes of calculating particular time intervals. This method of reprogramming the hardware interrupt timer, although accurate in determining elapsed time, is very intrusive into the computer system and is not considered a desirable practice, since once a programmer changes the programmed value in the hardware interrupt timer, all processes, applications and the like that depend on the system clock will be affected. If processes are supposed to occur at specified intervals, or at particular preprogrammed times, and the system clock has been changed so that it does not accurately reflect the true calendar date and time, then those processes will not occur, or will occur at incorrect times.
Another method for measuring the duration of particular processes in a computer system is the utilization of a software timer loop. In this method, a programmer creates a software loop that increments a value in a particular memory location every time the loop is called. At specified intervals within a particular process of interest, the software loop is called, thereby incrementing the particular memory location. To time the duration of a particular process, the central processing unit clears the value in the particular memory location (e.g., sets the memory location to equal zero) at the start of a process, and then calls the software timer loop at specific intervals within the particular process. At the end of the process, the central processing unit "reads" the value in the particular memory location and multiplies this value against the number of instruction cycles that occurred during each loop. This multiplied value is then multiplied against the system reference (e.g., the time for each instruction cycle) to determine the total elapsed time for the particular process.
A software timer loop, although it is nonintrusive on the computer system, has several disadvantages. First, it is difficult to calculate how many instructions are executed between each call to the software loop because the central processing unit may be interrupted several times during the particular process of interest. This causes it to execute other instructions before returning to the particular process. Since the other instructions that are executed upon interrupt of the central processing unit do not include a call to the software loop, the software loop will not increment the memory location until the central processing unit returns from the interrupt. If these other instructions are executed, their absence from the timing calculation will result in an incorrect value for the elapsed time.
An additional problem associated with utilizing software timing loop for calculating elapsed time in a computer system is that the software loop is not aware of hardware timing variations between different computer systems. The software timer merely multiplies the total number of instructions executed against the system reference. However, in most computer systems, the system reference is not the sole determining factor of system speed. Other factors include the speed at which the central processing unit operates, the response time of the system memory, the loading of the system bus, and the layout of the system board.
In a multimedia computing environment interacting with a CD-ROM drive or in other computer systems in which it is desirable to maximize overall performance and data throughput, it would be desirable to improve the arrangement for accurately determining the elapsed time of particular processes in a manner which is neither intrusive on the computer system itself, nor dependent on the particular timing characteristics of the computer system.